package com.dayatang.hrm.compensation.infra.hibernate;

import java.util.Date;
import java.util.List;

import org.apache.tapestry5.hibernate.HibernateSessionManager;

import com.dayatang.commons.repository.EntityRepositoryHibernateTapestry;
import com.dayatang.hrm.compensation.domain.SalaryAccountSuite;
import com.dayatang.hrm.compensation.domain.SalaryAccountSuiteRepository;
import com.dayatang.hrm.organisation.domain.Organization;

@SuppressWarnings("unchecked")
public class SalaryAccountSuiteRepositoryImpl extends
		EntityRepositoryHibernateTapestry<SalaryAccountSuite, Long> implements
		SalaryAccountSuiteRepository {

	public SalaryAccountSuiteRepositoryImpl(
			HibernateSessionManager sessionManager) {
		super(SalaryAccountSuite.class, sessionManager);
	}

	@Override
	public List<SalaryAccountSuite> findByOrganization(Organization org,
			Date queryDate) {
		return getSessionManager().getSession().getNamedQuery(
				"SalaryAccountSuite.findByOrganization").setEntity("pOrg", org)
				.setDate("pQueryDate", queryDate).list();
	}

}
